{template '_header'}

<div class="page-header">
    当前位置：<span class="text-primary"> 身份会员管理 </span>
</div>
<div class="page-content">
<form action="{php echo webUrl('identity/member')}" method="get" class="form-horizontal" role="form" id="form1">
    <input type="hidden" name="c" value="site" />
    <input type="hidden" name="a" value="entry" />
    <input type="hidden" name="m" value="ewei_shopv2" />
    <input type="hidden" name="do" value="web" />
    <input type="hidden" name="r" value="identity.member" />

    <div class="page-toolbar m-b-sm m-t-sm">
        <!-- <div class="col-sm-3">
            <span class='pull-left'>
                <a class='btn btn-primary btn-sm' href="{php echo webUrl('identity/member/add')}"><i class="fa fa-plus"></i> 添加身份</a>
            </span>
        </div> -->

        <div class="col-sm-8 pull-right">
            <div class="input-group">
                <div class="input-group-select">
                    <select name='status' class='form-control  input-sm select-md' style="width:100px;"  >
                        <option value='0'>状态</option>
                        <option value='2' {if $_GPC['status']=='2'}selected{/if}>未审核</option>
                        <option value='1' {if $_GPC['status']=='1'}selected{/if}>已审核</option>
                        <option value='4' {if $_GPC['status']=='4'}selected{/if}>已停用</option>
                        <option value='3' {if $_GPC['status']=='3'}selected{/if}>已过期</option>

                    </select>
                </div>
                <input type="text" class="form-control input-sm"  name="keyword" value="{$_GPC['keyword']}" placeholder="用户名称/用户等级/分销等级"/>
				<span class="input-group-btn">
                    <button class="btn btn-primary" type="submit"> 搜索</button>
				</span>
            </div>

        </div>
    </div>
</form>
{if count($list)>0}
<div class="page-table-header">
    <input type="checkbox">
    <div class="btn-group">
        {ifp 'identity.member.edit'}
        <a class='btn btn-default btn-sm btn-operation'  data-toggle='batch' data-href="{php echo webUrl('identity/member/status',array('status'=>1))}"  data-confirm='确认要启用该身份用户吗?'>
            <i class="icow icow-qiyong"></i>启用
        </a>
        <a class='btn btn-default btn-sm btn-operation'  data-toggle='batch' data-href="{php echo webUrl('identity/member/status',array('status'=>0))}" data-confirm='确认要禁用该身份用户吗?'>
            <i class="icow icow-jinyong"></i>禁用
        </a>
        <a class='btn btn-default btn-sm btn-operation'  data-toggle='batch' data-href="{php echo webUrl('identity/user/renew',array('status'=>0))}" data-confirm='确认要刷新身份用户吗?'>
            <i class="icow icow-jinyong"></i>刷新身份
        </a>
        {/if}
        {ifp 'identity.member.delete'}
        <a class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要删除?" data-href="{php echo webUrl('identity/member/delete')}">
            <i class='icow icow-shanchu1'></i> 删除
        </a>
        {/if}
    </div>
</div>

<table class="table table-responsive table-hover" >
    <thead class="navbar-inner">
    <tr>
        <th style="width:40px;"></th>
        <th style="width:70px;"></th>
        <th style="width:100px;">用户名</th>
        <th style="width:100px;">身份等级</th>
        <th>会员</th>
        <th>分销</th>
        <th>门店</th>
        <th>多商户</th>
        <th>股东</th>
        <th>区域</th>
        <th>到期日期</th>
        <th style="width:80px;">状态</th>
        <th style="width:80px;">操作</th>
    </tr>
    </thead>
    
    <tbody>
    {loop $list $row}
    <tr>
        <td>
            <input type='checkbox'   value="{$row['id']}"/>
        </td>
        <td><img src="{$row['avatar']}" width="50px;"></td>
        <td title="{$row['user_name']}">{$row['user_name']}</td>
        <td title="{$row['identity']}">{$row['identity']}</td>
        <td title="{$row['shop_user_grade']}">{$row['shop_user_grade']}</td>
        <td title="{$row['distribution_grade']}">{$row['distribution_grade']}</td>
        <td title="{$row['mendian_level']}">{$row['mendian_level']}</td>
        <td title="{$row['merch_level']}">{$row['merch_level']}</td>
        <td title="{$row['globonus_level']}">{$row['globonus_level']}</td>
        <td title="{$row['abonus_level']}">{$row['abonus_level']}</td>
        <td title="{$row['end_time']}">{$row['end_time']}</td>
        <td>
            
            <span class='label {if $row['status']==1}label-primary{else}label-default{/if}'
            {ifp 'identity.member.edit'}
            data-toggle='ajaxSwitch'
            data-switch-value='{$row['status']}'
            data-switch-value0='0|已停用|label label-default|{php echo webUrl('identity/member/status',array('status'=>1,'id'=>$row['id']))}'
            data-switch-value1='1|使用中|label label-success|{php echo webUrl('identity/member/status',array('status'=>3,'id'=>$row['id']))}'
            {/if} >
            {if $row['status']==1}使用中{elseif $row['status']==2}已过期{elseif $row['status']==3}已停用{else}待审核{/if}
            
            </span>
        </td>

        <td style="text-align:left;">

            {ifp 'identity.member.view|identity.member.edit'}
            <a href="{php echo webUrl('identity/member/edit', array('id' => $row['id']))}" class="btn btn-default btn-sm btn-op btn-operation">
                  <span data-toggle="tooltip" data-placement="top" title="" data-original-title=" {ifp 'identity.group.edit'}修改{else}查看{/if}">
                    <i class='icow icow-bianji2'></i>
               </span>
            </a>
            {/if}

            {ifp 'identity.member.delete'}
            <a data-toggle='ajaxRemove' class="btn btn-default btn-sm btn-op btn-operation ajaxRemove" data-confirm='确认要删除该身份吗?' href="{php echo webUrl('identity/member/delete', array('id'=>$row['id']))}" identityid="$row['id']">
              <span data-toggle="tooltip" data-placement="top" title="" data-original-title="删除">
                     <i class='icow icow-shanchu1'></i>
                </span></a>
            {/if}
        </td>
    </tr>
    {/loop}
    </tbody>
    <tfoot>
        <tr>
            <td><input type="checkbox"></td>
            <td colspan="9">
                <div class="btn-group">
                    {ifp 'identity.member.edit'}
                    <a class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{php echo webUrl('identity/member/status',array('status'=>1))}"><i class='icow icow-qiyong'></i> 启用</a>
                    <a class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch'  data-href="{php echo webUrl('identity/member/status',array('status'=>0))}"><i class='icow icow-jinyong'></i> 禁用</a>
                    {/if}
                    {ifp 'identity.member.delete'}
                    <a class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要删除?" data-href="{php echo webUrl('identity/member/delete')}"><i class='icow icow-shanchu1'></i> 删除</a>
                    {/if}
                </div>
            </td>
            <td colspan="3" class="text-right">
                {$pager}
            </td>
        </tr>
    </tfoot>
</table>

{else}
<div class='panel panel-default'>
    <div class='panel-body' style='text-align: center;padding:30px;'>
        暂时没有任何身份用户!
    </div>
</div>
{/if}
    </div>
<script language="javascript">
    // $(".ajaxRemove").click(function(){
    //     $.ajax({
    //         type: "GET",
    //         url: "{php echo webUrl('identity/member/delete')}",
    //         data: "id="+$(this).attr('identityid'),
    //         dataType: "json",
    //         success: function (data) {
    //             $(this).parent().parent().html();
    //         }
    //     });
    // });
        
</script>

{template '_footer'}
<!--6Z2S5bKb5piT6IGU5LqS5Yqo572R57uc56eR5oqA5pyJ6ZmQ5YWs5Y+4-->